package com.changgou.goods.service.impl;

import com.changgou.goods.dao.AuditingMapper;
import com.changgou.goods.pojo.Auditing;
import com.changgou.goods.service.AuditingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author Sherlock
 * @date 2020/3/31 下午 4:32
 */
@Service
public class AuditingServiceImpl implements AuditingService {

    @Autowired
    private AuditingMapper auditingMapper;

    /**
     * 通过商品Spu的Id查询该商品的审核记录
     * @param spuId 商品spu主键
     * @return
     */
    @Override
    public List<Auditing> findAuditingBySpuId(String spuId) {
        Example example = new Example(Auditing.class);
        example.createCriteria().andEqualTo("spuId", spuId);
        List<Auditing> auditingList = auditingMapper.selectByExample(example);
        return auditingList;
    }
}
